// Copyright 2022 a.o.smith ALL Rights Reserved
package com.liuxinlong.modules.dao.impl;

import com.liuxinlong.modules.dao.AssetsOrderExpandDao;
import com.liuxinlong.modules.entity.AssetsOrderExpand;
import com.liuxinlong.modules.mapper.AssetsOrderExpandMapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * AssetsOrderExpandDaoImpl
 *
 * @author liuxinlong@hotwater.com.cn
 * @version 1.0.0
 * @since 2024年02月29日
 */
@Service
public class AssetsOrderExpandDaoImpl extends ServiceImpl<AssetsOrderExpandMapper, AssetsOrderExpand> implements AssetsOrderExpandDao {

    @Override
    public List<AssetsOrderExpand> pageAssetsOrderExpandInfo(Map<String, Object> queryParam) {
        return baseMapper.pageAssetsOrderExpandInfo(queryParam);
    }

    @Override
    public int getAssetsOrderExpandInfoCount(Map<String, Object> queryParam) {
        return baseMapper.getAssetsOrderExpandInfoCount(queryParam);
    }

    @Override
    public List<AssetsOrderExpand> getAssetsOrderExpandList(Map<String, Object> queryParam) {
        return baseMapper.getAssetsOrderExpandList(queryParam);
    }

    @Override
    public void updateAssetIdByNo(String assetsNo, String assetsId) {
        baseMapper.updateAssetIdByNo(assetsNo, assetsId);
    }

    @Override
    public Map<String, AssetsOrderExpand> getAssetsOrderExpandMap() {
        Map<String, Object> queryParam = new HashMap<>();
        queryParam.put("startNum", 0);
        queryParam.put("pageSize", 100000);
        List<AssetsOrderExpand> originalList = baseMapper.pageAssetsOrderExpandInfo(queryParam);
        Map<String, AssetsOrderExpand> orderMap = new HashMap<>(originalList.size());
        for (AssetsOrderExpand order : originalList) {
            orderMap.put(order.getAssetsNo(), order);
        }
        return orderMap;
    }

}
